//
//  CustomButton.m
//  ZhongLiXunTA
//
//  Created by 众里寻TA on 14-12-25.
//  Copyright (c) 2014年 李 剣. All rights reserved.
//

#import "CustomButton.h"
#import "JTCSM.h"
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
@implementation CustomButton

- (void)systemButtonWithFrame:(CGRect)frame imageName:(NSString *)imageName title:(NSString *)title target:(id)target action:(SEL)action
{
    CGFloat width = frame.size.width;
    self.frame = frame;
    self.backgroundColor = [UIColor clearColor];
    UIImage *image=[UIImage imageNamed:imageName];
    _imgView=[[UIImageView alloc] initWithImage:image];
    _imgView.frame = CGRectMake(0, 5, 25, 25);
    _imgView.center = CGPointMake(self.frame.size.width/2, _imgView.frame.origin.y+_imgView.frame.size.height/2);
    _imgView.backgroundColor = [UIColor clearColor];
    [df layerWithView:_imgView radius:0 width:.1 color:[UIColor clearColor]];
    
    _label=[[UILabel alloc] init];
    _label.frame = CGRectMake(0, 30, width, 8);
    _label.center = CGPointMake(self.frame.size.width/2,40);
    _label.text=title;
    _label.textAlignment=NSTextAlignmentCenter;
    _label.backgroundColor = [UIColor clearColor];
    _label.font=[UIFont systemFontOfSize:11];
    _label.textColor = RGBACOLOR(152, 152, 152, 1);
    [self addSubview:_imgView];
    [self addSubview:_label];

    [self addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
